package com.zhaoxi.project.system.service.impl;

import java.util.List;

import com.zhaoxi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhaoxi.project.system.mapper.SysTenantMapper;
import com.zhaoxi.project.system.domain.SysTenant;

/**
 * 租户Service业务层处理
 *
 * @author zhaoxi
 * @date 2023-08-07
 */
@Service
public class SysTenantServiceImpl {
    @Autowired
    private SysTenantMapper sysTenantMapper;

    /**
     * 查询租户
     *
     * @param tenantId 租户主键
     * @return 租户
     */

    public SysTenant selectSysTenantByTenantId(Long tenantId) {
        return sysTenantMapper.selectSysTenantByTenantId(tenantId);
    }

    /**
     * 查询租户列表
     *
     * @param sysTenant 租户
     * @return 租户
     */

    public List<SysTenant> selectSysTenantList(SysTenant sysTenant) {
        return sysTenantMapper.selectSysTenantList(sysTenant);
    }

    /**
     * 新增租户
     *
     * @param sysTenant 租户
     * @return 结果
     */

    public int insertSysTenant(SysTenant sysTenant) {
        sysTenant.setCreateTime(DateUtils.getNowDate());
        return sysTenantMapper.insertSysTenant(sysTenant);
    }

    /**
     * 修改租户
     *
     * @param sysTenant 租户
     * @return 结果
     */

    public int updateSysTenant(SysTenant sysTenant) {
        return sysTenantMapper.updateSysTenant(sysTenant);
    }

    /**
     * 批量删除租户
     *
     * @param tenantIds 需要删除的租户主键
     * @return 结果
     */

    public int deleteSysTenantByTenantIds(Long[] tenantIds) {
        return sysTenantMapper.deleteSysTenantByTenantIds(tenantIds);
    }

    /**
     * 删除租户信息
     *
     * @param tenantId 租户主键
     * @return 结果
     */

    public int deleteSysTenantByTenantId(Long tenantId) {
        return sysTenantMapper.deleteSysTenantByTenantId(tenantId);
    }
}
